IF OBJECT_ID('ssf.job_datetime_floor') IS NOT NULL
	DROP FUNCTION ssf.job_datetime_floor
GO

CREATE FUNCTION ssf.job_datetime_floor (
	@datetime DATETIME = NULL
)
RETURNS DATETIME
AS
BEGIN
/*
<object_header>

<object_summary>
	<purpose><![CDATA[
In sysjobhistory, job activity date/time has a resolution of seconds and it seems that the time value is not rounded
but rather truncated to seconds.  Given a date/time, return the value that would be logged in sysjobhistory.
	]]></purpose>
</object_summary>

</object_header>
*/

	RETURN (CONVERT(VARCHAR, @datetime, 120))
END
GO
